﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master/AdminSite.Master"
    AutoEventWireup="true" CodeBehind="ParameterForm.aspx.cs" Inherits="OMSWeb.Admin.Systems.ParameterForm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script type="text/javascript">
        //bind
        var grid = null;
        $(function() {
            grid = $("#maingrid4").ligerGrid({
                height: '100%',
                checkbox: true,
                columns: [{ display: ' 编号', name: 'Id' },
                { display: '参数类型', name: 'TypeName' },
                { display: '参数名称', name: 'Name' },
                { display: '参数值', name: 'Value' }
                ],
                toolbar: { items: [

                { text: '增加', click: add_Open, icon: 'add' },
                { line: true },
                { text: '修改', click: update_Open, icon: 'modify' },
                { line: true },
                { text: '删除', click: f_getChecked, img: '../../../lib/ligerUI/skins/icons/delete.gif' }
                ]
                },

                url: "../../service/Systems/ParameterHandler.ashx?Action=get&View=Home",
                showTitle: false, dataAction: 'server', sortName: 'Id',
                pageSize: 5,
                pageSizeOptions: [5, 10, 15], where: f_getWhere(),

                isChecked: f_isChecked, onCheckRow: f_onCheckRow, onCheckAllRow: f_onCheckAllRow

            });
        });
        function f_reload() {
            grid.loadData();
        }

        function itemclick(item) {
            alert(item.text);
        }






      
    </script>

    <script type="text/javascript">
        //grid event


        function f_onCheckAllRow(checked) {
            for (var rowid in this.records) {
                if (checked)
                    addCheckedCustomer(this.records[rowid]['Id']);
                else
                    removeCheckedCustomer(this.records[rowid]['Id']);
            }
        }


        /*
        该例子实现 表单分页多选
        即利用onCheckRow将选中的行记忆下来，并利用isChecked将记忆下来的行初始化选中
        */
        var checkedCustomer = [];
        function findCheckedCustomer(homeChargeId) {
            for (var i = 0; i < checkedCustomer.length; i++) {
                if (checkedCustomer[i] == homeChargeId) return i;
            }
            return -1;
        }
        function addCheckedCustomer(homeChargeId) {
            if (findCheckedCustomer(homeChargeId) == -1)
                checkedCustomer.push(homeChargeId);
        }
        function removeCheckedCustomer(homeChargeId) {
            var i = findCheckedCustomer(homeChargeId);
            if (i == -1) return;
            checkedCustomer.splice(i, 1);
        }
        function f_isChecked(rowdata) {
            if (findCheckedCustomer(rowdata.homeChargeId) == -1)
                return false;
            return true;
        }
        function f_onCheckRow(checked, data) {
            if (checked) addCheckedCustomer(data.Id);
            else removeCheckedCustomer(data.Id);
        }
        function f_getChecked() {
            alert(checkedCustomer.join(','));
        }

        function f_getWhere() {
            if (!grid) return null;
            var clause = function(rowdata, rowindex) {
                var key = $("#txtKey").val();
                return rowdata.homeChargeId.indexOf(key) > -1;
            };
            return clause;
        }
        function f_search() {
            //grid.options.data = $.extend(true, {}, CustomersData);
            grid.loadData(f_getWhere());
        }
    
    </script>

    <script type="text/javascript">
        //event
        var win;
        function add_Open() {
            if (win) win.show();
            else win = $.ligerDialog.open({ height: 200, url: 'ParameterSaveRoUpdateForm.aspx', height: 450, width: 600, showMax: true, showToggle: true, showMin: true, isResize: true, slide: false });
        }
        function update_Open() {
         }
    </script>

    <div id="searchbar" class="message">
        <table class="table">
            <tr>
                <td class="td" align="right">
                    参数类型：
                </td>
                <td>
                    <input id="txtTypeName" type="text" />
                </td>
                <td class="td" align="right">
                    参数名称：
                </td>
                <td>
                    <input id="txtName" type="text" />
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="td" align="right">
                    参数值：
                </td>
                <td>
                    <input id="txtValue" type="text" />
                </td>
                <td class="td" align="right">
                    手机：
                </td>
                <td class="td">
                    <input id="txtPhone" type="text" />
                </td>
                <td class="td">
                    <input id="btnOK" type="button" value="搜 索" onclick="f_search()" class="l-button l-button-submit" />
                </td>
            </tr>
        </table>
    </div>
    <div id="maingrid4">
    </div>
</asp:Content>
